﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.Script.Serialization;

namespace Kevin.Controls
{
    [Serializable]
    
    public class MenuItem
    {
        public MenuItem() { }
        public MenuItem(string id,string powerID,string link,string text,string image,string cssClass) 
        {
            this.ID = id;
            this.PowerID = powerID;
            this.Link = link;
            this.Text = text;
            this.Image = image;
            this.CssClass = cssClass;
        }

        public string Level
        {
            get;
            set;
        }
        public string ID
        {
            get;
            set;
        }
        public string PowerID
        {
            get;
            set;
        }

        public string Link
        {
            get;
            set;
        }

        public string Text
        {
            get;
            set;
        }

        public string Image
        {
            get;
            set;
        }

        public string CssClass
        {
            get;
            set;
        }

        public string Script
        {
            get;
            set;
        }

        public bool HasChildMenu
        {
            get {
                if (ChildMenu == null)
                    return false;
                return this.ChildMenu.Count > 0; 
            }
        }
        List<MenuItem> _ChildMenu = new List<MenuItem>();
        
        public List<MenuItem> ChildMenu
        {
            set { _ChildMenu = value; }
            get { return _ChildMenu; }
        }

        public MenuItem ParentMenu
        {
            get;
            set;
        }

    }

    public class MenuCollection : CollectionBase
    {
        public void Add(MenuItem item)
        {
            base.List.Add(item);
        }
    }
}
